import {createStore} from 'vuex'
import themeColors from '@/util/themeColors.js'
import * as storage from '@/util/storage.js'

const store = createStore({
	state: {
		themeConfig: themeColors[storage.getTheme()]
	},
	mutations: {
		SET_THEME: (state, theme) => {
			state.themeConfig = themeColors[theme]
		}
	},
	actions: {
		setTheme({
			commit
		}, theme) {
			commit('SET_THEME', theme)
		}
	}
})
export default store
